﻿<!-- #include virtual="/Inc/conn.asp"-->
<!-- #include virtual="/Inc/md5.asp"-->
<!-- #include virtual="/Inc/function.asp"-->
<!-- #include virtual="/Inc/config.asp"-->
<!-- #include virtual="/Inc/Admin/common.asp"-->
<%
Dim cid,num,words,ptitle,picurl,width,height,i
cid=clng(Request("cid"))
num=clng(Request("num"))
words=clng(Request("words"))
width=clng(Request("width"))
height=clng(Request("height"))
%>
var focus_width=<%=width%>;
var focus_height=<%=height%>;
var text_height=20;
var swf_height = focus_height+text_height;

var imag=new Array();
var link=new Array();
var text=new Array();
<%
sql="select top " & num & " * from db_page where pageid=" & cid
set rs = Server.CreateObject("adodb.recordset")
i=1
rs.Open sql,conn,1,1
do while not rs.eof
picurl=rs("pic")
ptitle=rs("title")
if len(ptitle)>words then ptitle=left(ptitle,words) & "..."
%>
imag[<%=i%>]="<%=picurl%>";
link[<%=i%>]="#";
text[<%=i%>]="<%=ptitle%>";
<%
i=i+1
rs.movenext
loop
rs.close
%>
var pics="", links="", texts="";
for(var i=1; i<imag.length; i++){
	pics=pics+("|"+imag[i]);
	links=links+("|"+link[i]);
	texts=texts+("|"+text[i]);
}

pics=pics.substring(1);
links=links.substring(1);
texts=texts.substring(1);

var swfhtml='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">';
swfhtml+='<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/swf/picviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#DADADA">';
swfhtml+='<param name="menu" value="false"><param name=wmode value="opaque">';
swfhtml+='<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">';
swfhtml+='<embed src="/swf/picviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#DADADA" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
swfhtml+='</object>';

$('#p_preview').htm(swfhtml);